import hello from "./test";
import imgsrc from "./assets/img-1.png"
import imgsvg from './assets/webpack-logo.svg'
import txt from './assets/hello.txt'
import jpgMap from './assets/qianfeng-sem.jpg'
import './style.less'
import Data from './assets/data.xml'
import Notes from './assets/data.csv'
import toml from './assets/data.toml'
import yaml from './assets/data.yaml'
import json5 from './assets/data.json5'
import HW from "./helloworld";
import _ from 'lodash'
import './async-module'

//用动态导入--做懒加载文件
    // 魔法注释：/* xxx */
    // webpackChunkName:定义输出文件名
    // webpackPrefetch:预获取--》在浏览器空闲是加载
    //  webpackPreload:预加载
const button = document.createElement('button')
button.textContent = '点击执行加法运算'
button.addEventListener('click',()=>{
    import(/*webpackChunkName: 'math', webpackPreload: true */ './math.js').then(({add}) => {
        console.log(add(4,5));
    })
})
document.body.appendChild(button)

console.log(_.join(['Another', 'module', 'loaded!'], ' '))

console.log(Data,Notes);
HW()
hello()
const img = document.createElement('img')
img.src = imgsrc
document.body.appendChild(img)

const img2 = document.createElement('img')
img2.style.cssText = "width:200px;height:200px"
img2.src = imgsvg
document.body.appendChild(img2)

const txtcontent = document.createElement('div') 
txtcontent.style.cssText = "width:200px;height:200px;background-color:#58bc58;"
txtcontent.textContent = txt
document.body.appendChild(txtcontent)

const jb = document.createElement('img') 
jb.style.cssText = "width:600px;height:240px;display:block;"
jb.src = jpgMap
document.body.appendChild(jb)

console.log(toml,yaml,json5);
